package com.eschool.beans;

import java.util.Date;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

import com.eschool.service.TimeTableService;
import com.eschool.service.impl.TimeTableServiceImpl;


@ManagedBean(name="makeTimeTableBean")
@ViewScoped
public class MakeTimeTableBean {
	
	private Date schoolStart;
	private Date schoolEnd;
	private Date breakStart;
	private Date breakEnd;
	private TimeTableService service = new TimeTableServiceImpl();
	
	public Date getSchoolStart() {
		return schoolStart;
	}
	public void setSchoolStart(Date schoolStart) {
		this.schoolStart = schoolStart;
	}
	public Date getSchoolEnd() {
		return schoolEnd;
	}
	public void setSchoolEnd(Date schoolEnd) {
		this.schoolEnd = schoolEnd;
	}
	public Date getBreakStart() {
		return breakStart;
	}
	public void setBreakStart(Date breakStart) {
		this.breakStart = breakStart;
	}
	public Date getBreakEnd() {
		return breakEnd;
	}
	public void setBreakEnd(Date breakEnd) {
		this.breakEnd = breakEnd;
	}
	
	public String make(){
		String output = service.prepareTimeable(schoolStart, schoolEnd, breakStart, breakEnd);
		//Time startTime = new Time((28800000) + 8 * 60 * 60 * 1000);		System.out.println(startTime.getTime());
		//System.out.println((new Time(schoolStart.getTime())).getTime());
		
		if(output.equals("done"))
			return "viewTimeTable";
		else
			return "";
	}
}
